package com.leosoft.heatmonitor.control;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.leosoft.heatmonitor.service.transactional.LocationService;

@Controller
@RequestMapping("/location")
public class LocaitonController {
	@Autowired(required = true)
	LocationService locationService;

	@RequestMapping(value = "/getProvince")
	@ResponseBody
	List<String> getProvince() {
		return locationService.getProvince();
	}

	@RequestMapping(value = "/getCity", method = RequestMethod.POST)
	@ResponseBody
	List<String> getCity(@RequestParam("province") String province) {
		return locationService.getCity(province);
	}

	@RequestMapping(value = "/getDistrict", method = RequestMethod.POST)
	@ResponseBody
	List<String> getDistrict(@RequestParam("province") String province,
			@RequestParam("city") String city) {
		return locationService.getDistrict(province, city);
	}

}
